package com.six.firstpage.controller.api;


import com.six.core.vo.Result;
import com.six.firstpage.util.UploadUntil;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * @projectName: myssm02
 * @package: com.zzh.controller
 * @className: UploadController
 * @author: ZZH
 * @description: TODO
 * @date: 2022/9/29 15:51
 * @version: 1.0
 */
@RestController
@RequestMapping("/firstpage/api")
public class ApiUploadController {

    @RequestMapping("/imgupload")
    public Result headUpload(MultipartFile file){
        System.out.println("----------------------------图片上传请求");
        try {
            String s = UploadUntil.ossUpload(file);
            return new Result(2000,"上传成功",s);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return new Result(5000,"上传失败");
    }

}
